# coding:utf-8
from __future__ import unicode_literals

from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.models import Group

# Create your models here.

STATUS = (
    (u'O', 'open'),
    (u'C', 'close'),
    (u'D', 'delete')
)


class Projects(models.Model):
    create_user = models.ForeignKey(User,on_delete=models.CASCADE)
    title = models.CharField(max_length=200)
    description = models.TextField(blank=True)
    start_time = models.DateField(blank=True)
    end_time = models.DateField(blank=True)
    status = models.CharField(max_length=2, choices= STATUS)
    user_group = models.ForeignKey(Group,on_delete=models.CASCADE)


class Tasks(models.Model):
    project = models.ForeignKey(Projects,on_delete=models.CASCADE)
    title = models.CharField(max_length=200,)
    description = models.TextField(blank=True)
    start_time = models.TimeField(blank=True)
    end_time = models.TimeField(blank=True)
    parent_task = models.CharField(blank=True,max_length=5)
